//
//  UIImage+Extension.swift
//  YHWeibo
//
//  Created by 昱含 on 16/5/28.
//  Copyright © 2016年 YuHan. All rights reserved.
//

import UIKit
extension UIImage{
    
    class func snapCurrentWindow() -> UIImage{
        
        let window = UIApplication.sharedApplication().keyWindow!
        
        UIGraphicsBeginImageContextWithOptions(window.bounds.size, false, UIScreen.mainScreen().scale)
        
        window.drawViewHierarchyInRect(window.bounds, afterScreenUpdates: false)
        
        let image = UIGraphicsGetImageFromCurrentImageContext()
        
        UIGraphicsEndImageContext()
        
        return image
    
    }
}
